<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="myAuthorLabel" jhiTranslate="greatBigExampleApplicationApp.author.home.createOrEditLabel">Create or edit a Author</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!author.id">
            <label for="id" jhiTranslate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="author.id" readonly />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="greatBigExampleApplicationApp.author.bio" for="field_bio">Bio</label>
            <textarea class="form-control" name="bio" id="field_bio"
                [(ngModel)]="author.bio"  ></textarea>
        </div>

        <div class="form-group">
            <label jhiTranslate="greatBigExampleApplicationApp.author.user" for="field_user">User</label>
            <select class="form-control" id="field_user" name="user" [(ngModel)]="author.user" >
                <option [ngValue]="null"></option>
                <option [ngValue]="userOption.id === author.user?.id ? author.user : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.login}}</option>
            </select>
        </div>
        <div class="form-group">
            <label jhiTranslate="greatBigExampleApplicationApp.author.follower" for="field_follower">Follower</label>
            <select class="form-control" id="field_follower" multiple name="follower" [(ngModel)]="author.followers">
                <option [ngValue]="getSelected(author.followers, authorOption)" *ngFor="let authorOption of authors; trackBy: trackAuthorById">{{authorOption.id}}</option>
            </select>
        </div>
        <div class="form-group">
            <label jhiTranslate="greatBigExampleApplicationApp.author.favorite" for="field_favorite">Favorite</label>
            <select class="form-control" id="field_favorite" multiple name="favorite" [(ngModel)]="author.favorites">
                <option [ngValue]="getSelected(author.favorites, articleOption)" *ngFor="let articleOption of articles; trackBy: trackArticleById">{{articleOption.id}}</option>
            </select>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
            <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
        </button>
    </div>
</form>
